# 检查Java文件的基本问题

$javaFiles = Get-ChildItem -Path "src\main\java" -Filter "*.java" -Recurse

foreach ($file in $javaFiles) {
    try {
        $bytes = [System.IO.File]::ReadAllBytes($file.FullName)
        
        # 检查BOM字符
        if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
            Write-Host "BOM found in: $($file.Name)"
        }
        
        $content = Get-Content $file.FullName -Raw -Encoding UTF8
        
        # 检查基本语法问题
        $lines = $content -split "\r?\n"
        for ($i = 0; $i -lt $lines.Length; $i++) {
            $line = $lines[$i]
            
            # 检查import语句后是否有非法内容
            if ($line -match "^import\s+[^;]+;" -and $i+1 -lt $lines.Length) {
                $nextLine = $lines[$i+1]
                if ($nextLine -match "^\s*private\s+static\s+final\s+Logger") {
                    Write-Host "Logger in imports at line $($i+2) in: $($file.Name)"
                }
            }
        }
    }
    catch {
        Write-Host "Error reading file: $($file.Name) - $($_.Exception.Message)"
    }
}

Write-Host "File check completed!"